<template>
    <div
        class="highriskvalidate"
        v-loading="pageLoading"
        element-loading-background="rgba(255, 255, 255, 0.7)"
    >
        <cardComponent pageTitle="高风险业务身份验证">
            <template slot="cardBody">
                <div class="pageTips">
                    <div class="leftBox">
                        <p>
                            <el-radio-group v-model="checkMustForm.ifhascard" @change="countanswer">
                                <el-radio label="1">可获得卡片信息：{{riskitem1}}</el-radio>
                                <el-radio label="0">无法获得卡片信息：{{riskitem2}}</el-radio>
                            </el-radio-group>
                        </p>
                    </div>
                    <div class="rightBox">
                        <el-button
                            size="small"
                            icon="el-icon-circle-check"
                            type="primary"
                            @click="handlePass"
                        >提 交</el-button>
                        <el-button size="small" type="primary" @click="resetRiskCheck">清 除</el-button>
                    </div>
                </div>
                <div class="box-group businessIndex">
                    <p class="title">必核项</p>
                    <div class="content">
                        <el-row>
                            <el-col :span="12">
                                <div class="pStyle">
                                    <span class="title">证件号码：</span>
                                    <div class="cell">{{customerInfo_3002.CUSTID}}</div>
                                    <el-radio-group
                                        v-model="checkMustForm.idnopass"
                                        :disabled="idnocheckflag"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio v-if="checkMustForm.idnopass==='0'" label="0">
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">卡片有效期：</span>
                                    <div class="cell">{{cardInfo_3004.EXPIRE}}</div>
                                    <el-radio-group
                                        v-model="checkMustForm.expirepass"
                                        :disabled="expirecheckflag"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio v-if="checkMustForm.expirepass==='0'" label="0">
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                            </el-col>
                            <el-col :span="12">
                                <div class="pStyle">
                                    <span class="title">卡号：</span>
                                    <div class="cell">{{cardInfo_3004.CARDNO}}</div>
                                    <el-radio-group
                                        v-model="checkMustForm.cardnopass"
                                        :disabled="cardnocheckflag"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio v-if="checkMustForm.cardnopass==='0'" label="0">
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                </div>
                <div class="box-group businessIndex">
                    <p class="title">选核项</p>
                    <div class="content">
                        <el-row>
                            <el-col :span="12">
                                <div class="pStyle">
                                    <span class="title">手机号码：</span>
                                    <div class="cell">{{customerInfo_3002.MOBILEPHONE}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.mbphonepass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.mbphonepass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">电子邮箱：</span>
                                    <div class="cell">{{customerInfo_3002.EMAIL}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.emailpass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio v-if="checkUnmustForm.emailpass==='0'" label="0">
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">单位名称：</span>
                                    <div class="cell">{{customerInfo_3002.BUSINAME}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.comnamepass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.comnamepass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">账单日：</span>
                                    <div class="cell">{{cardAccountInfo_3001.CYCLNBR}}日</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.stmtdaypass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.stmtdaypass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">账单地址：</span>
                                    <div class="cell" :title="stmtaddress">{{stmtaddress}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.stmtaddrpass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.stmtaddrpass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">单位地址：</span>
                                    <div class="cell" :title="compaddress">{{compaddress}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.comaddrpass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.comaddrpass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">信用额度：</span>
                                    <div class="cell">{{cardInfo_3004.CRDLIMT}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.crdlimtpass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.crdlimtpass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">住宅电话：</span>
                                    <div class="cell">{{customerInfo_3002.HOMEPHONE}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.homephonepass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.homephonepass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                            </el-col>
                            <el-col :span="12">
                                <div class="pStyle">
                                    <span class="title">预留联系人：</span>
                                    <div class="cell" :title="conname">{{conname}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.connamepass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.connamepass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">账单地址类型：</span>
                                    <div
                                        class="cell"
                                    >{{customerAdressInfo_3003.STSMAIL|STMTP_filter}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.stmtaddtppass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.stmtaddtppass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">姓名汉字拼写：</span>
                                    <div class="cell">{{customerInfo_3002.CHINAME}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.cnamepass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio v-if="checkUnmustForm.cnamepass==='0'" label="0">
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">自扣还款方式：</span>
                                    <div
                                        class="cell"
                                    >{{AutoRepayAcct_4017.REPAYCODE | PAYFALG_filter}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.autopaypass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.autopaypass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">住宅地址：</span>
                                    <div class="cell" :title="homeaddress">{{homeaddress}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.homeaddrpass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.homeaddrpass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">预留问题答案：</span>
                                    <div class="cell" :title="reservinfos">{{reservinfos}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.resv2pass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio v-if="checkUnmustForm.resv2pass==='0'" label="0">
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">单位电话：</span>
                                    <div class="cell">{{customerInfo_3002.BUSIPHONE}}</div>
                                    <el-radio-group
                                        v-model="checkUnmustForm.comphonepass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio
                                            v-if="checkUnmustForm.comphonepass==='0'"
                                            label="0"
                                        >
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                                <div class="pStyle">
                                    <span class="title">最近一笔交易：</span>
                                    <el-radio-group
                                        v-model="checkUnmustForm.cpurpass"
                                        @change="countanswer"
                                        :disabled="isShow"
                                    >
                                        <el-radio label="1">对</el-radio>
                                        <el-radio v-if="checkUnmustForm.cpurpass==='0'" label="0">
                                            <span style="color:red;">错</span>
                                        </el-radio>
                                        <el-radio v-else label="0">错</el-radio>
                                    </el-radio-group>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                </div>
            </template>
        </cardComponent>
    </div>
</template>

<script>
import { mapState } from 'vuex';
import moment from 'moment';
import cardComponent from '@/components/cardComponent/cardComponent.vue';
import applyList from './components/applyList.vue';
import contactList from './components/contactList.vue';
import supplementCardList from './components/supplementCardList.vue';
import { getDictSelectList, closePage, trimString } from '@/utils/Common';

export default {
    name: 'highriskvalidate',
    components: {
        cardComponent,
        'apply-list': applyList,
        'contact-list': contactList,
        'supplement-card-list': supplementCardList,
    },

    data() {
        return {
            pageLoading: false, // 页面loading
            passFlag: false, // 通过按钮 禁用标志
            isShow: false,//选核项答案是否不可用
            allMustQuestion: [], // 必核项题库
            allQuestionA: [], // A类题库
            allQuestionB: [], // B类题库
            mustQuestion: [], // 页面展示必核项问题
            questionA: [], // 页面展示的A类问题
            questionB: [], // 页面展示的B类问题
            idTypeList: [], // 证件类型列表
            cardstatList: [],
            stmtaddress: '',//账单地址
            compaddress: '',//公司地址
            homeaddress: '',//家庭地址
            result3011: [],//未出账单明细列表
            RTNIND: '',
            VALDATE: '',
            PURDATE: '',
            PURTIME: '',
            TRANNO: '',
            riskLevel: '',//菜单风险级别
            riskitemsList: [],
            riskitem1: '',
            riskitem2: '',
            riskleveldesc: '',
            totanswercount: 0,//总选核答题数
            succanswercount: 0,//选核答题正确题数
            erranswercount: 0,//选核答题错误题数
            cardnocheckflag: false,
            idnocheckflag: false,
            expirecheckflag: false,
            ifaddcheck: false,//是否是附加项核验
            conname: '',
            reservinfos: '',//预留问题和答案
        };
    },

    mounted() {
        this.init();
    },

    // 取缓存信息
    computed: mapState({
        cardAccountInfo_3001: state => state.common.cardAccountInfo_3001, // 卡账户信息
        customerInfo_3002: state => state.common.customerInfo_3002, // 客户信息
        customerAdressInfo_3003: state => state.common.customerAdressInfo_3003, // 客户地址信息
        cardInfo_3004: state => state.common.cardInfo_3004, // 默认卡信息
        AutoRepayAcct_4017: state => state.common.AutoRepayAcct_4017,
        defaultParams: state => state.common.defaultParams, // 接口默认参数
        checkMustForm: state => state.common.checkMustForm, // 风险验证必核项验证内容
        checkUnmustForm: state => state.common.checkUnmustForm, // 风险验证选核项验证内容
        currentRiskLevel: state => state.common.currentRiskLevel, // 当前风验证通过标识
        currentSessionObj: state => state.common.currentSessionObj, // 客户查询密码通过标识等信息
    }),

    filters: {
        getFormatValue(val, list) {
            let text = '';
            if (val && val.trim()) {
                list.forEach((item) => {
                    if (item.code === val.trim()) {
                        text = item.label;
                    }
                });
            }
            return text;
        },

        filterCardstat: (value, cardstatList) => {
            value = (`${value}`).trim();
            let txt = '';

            for (let index = 0; index < cardstatList.length; index++) {
                const element = cardstatList[index];
                if (element.code === value) {
                    txt = element.label;
                }
            }
            if (value === '') {
                txt = '正常';
            }
            return txt;
        },
        STMTP_filter: (value) => {
            value = (`${value}`).trim();
            switch (value) {
                case 'H':
                    return '家庭地址';
                    break;
                case 'B':
                    return '公司地址';
                    break;
                default:
                    break;
            }
        },
        PAYFALG_filter: (value) => {
            value = (`${value}`).trim();
            switch (value) {
                case 'F':
                    return '固定金额';
                    break;
                case 'M':
                    return '最低还款额';
                    break;
                case 'T':
                    return '全额还款';
                    break;
                case 'P':
                    return '按百分比还款';
                    break;
                default:
                    break;
            }
        },
        // 获取日期时间转换
        getFormatDate(time, date, date1) {
            let res = '';
            let str = '';
            let tmp = '';
            const timeStr = time.toString().trim();
            if (date !== 0) {
                tmp = `00000000${timeStr}`;
                tmp = tmp.substring(tmp.length - 8, tmp.length);
                str = tmp.substring(0, 2).concat(':').concat(tmp.substring(2, 4)).concat(':')
                    .concat(tmp.substring(4, 6));
            }
            let Str = '';
            if (date) {
                const dateStr = date.toString().trim();
                const month1 = Number(date1.substring(0, 2));
                const month2 = Number(dateStr.substring(4, 6));
                if (month1 - month2 === 11) {
                    const year = `${Number(dateStr.substring(0, 4)) - 1}`;
                    Str = year.concat('-').concat(date1.substring(0, 2)).concat('-').concat(date1.substring(2, 4));
                } else {
                    Str = dateStr.substring(0, 4).concat('-').concat(date1.substring(0, 2)).concat('-')
                        .concat(date1.substring(2, 4));
                }

                res = `${Str} ${str}`;
            }
            return res;
        },
        // 卡号末四位自动补0
        formatCardend(val) {
            return val.toString().padStart(4, '0');
        },
        // 日期格式转换
        formatDate(val) {
            const text = `${val}`;
            return moment(text).format('YYYY-MM-DD');
        },
        //格式化交易金额，加上交易金额符号，精确小数点后2位小数
        formatAmount(amt, flag) {
            if (flag === '-') {
                amt = parseFloat(-1.00 * amt).toFixed(2);
            } else {
                amt = parseFloat(1.00 * amt).toFixed(2);
            }
            return amt;
        },
    },

    methods: {
        // 初始化查询
        async init() {

            //获取菜单风险级别
            //this.riskLevel = this.$route.params.riskLevel;
            this.riskitemsList = await getDictSelectList('RISKLEVEL_HIGH', this);
            if (this.riskitemsList.length > 0) {
                for (let i = 0; i < this.riskitemsList.length; i++) {
                    if (this.riskitemsList[i].code === 'hascard') {
                        this.riskitem1 = this.riskitemsList[i].label;
                    } else if (this.riskitemsList[i].code === 'nocard') {
                        this.riskitem2 = this.riskitemsList[i].label;
                    }
                }
            }

            // 证件类型列表
            this.idTypeList = await getDictSelectList('IDTYPE', this);

            this.cardstatList = await getDictSelectList('CLOCD', this);

            this.homeaddress = this.stmtaddress = this.customerAdressInfo_3003.ADD11.trim() + this.customerAdressInfo_3003.ADD12.trim() + this.customerAdressInfo_3003.ADD13.trim() + this.customerAdressInfo_3003.ADD14.trim() + this.customerAdressInfo_3003.ADD15.trim();
            this.compaddress = this.customerAdressInfo_3003.ADD21.trim() + this.customerAdressInfo_3003.ADD22.trim() + this.customerAdressInfo_3003.ADD23.trim() + this.customerAdressInfo_3003.ADD24.trim() + this.customerAdressInfo_3003.ADD25.trim();

            if (this.customerAdressInfo_3003.STSMAIL + '' === 'H') {
                this.stmtaddress = this.homeaddress;
            } else if (this.customerAdressInfo_3003.STSMAIL + '' === 'B') {
                this.stmtaddress = this.compaddress;
            }
            console.log("this.stmtaddress", this.stmtaddress);
            if (this.customerInfo_3002.RESERVE.trim() !== '' || this.customerInfo_3002.RESERVE2.trim() !== '') {
                this.reservinfos = this.customerInfo_3002.RESERVE.trim() + '/' + this.customerInfo_3002.RESERVE2.trim();
            }
            //判断是否是加核项核验，如果是加核项核验就不能做高风险核验，两者互斥
            //如果客户通过了查询密码验证，但是非预留手机号码来电，做加核项核验，否则做高风险核验
            console.log("this.currentSessionObj", this.currentSessionObj.ani);
            if (!(this.currentSessionObj.ani === '' || this.currentSessionObj.ani === undefined)) {
                let anis = trimString(this.currentSessionObj.ani);
                if (this.currentSessionObj.ivrData.data.AUTH === '1') {
                    if (anis.substring(anis.length - 6, anis.length) != homephone6 && anis.substring(anis.length - 11, anis.length) != mbphone11) {
                        this.ifaddcheck = true;
                    }
                } else {
                    this.ifaddcheck = false;
                }
            }
            if (this.ifaddcheck) {
                this.idnocheckflag = true;
                this.expirecheckflag = true;
                this.cardnocheckflag = true;

            } else {
                if (this.checkMustForm.ifhascard === '0') { //如果不可获得卡片信息，选核项答题总数为3，即刻把所有选核项题目锁定不可选
                    this.idnocheckflag = false;
                    this.cardnocheckflag = true;
                    this.expirecheckflag = true;
                }
                // this.idnocheckflag = false;
                // this.expirecheckflag = false;
                // this.cardnocheckflag = false;
            }
            await this.get3064();
        },
        async get3064() {
            console.log('查询3064');
            const appBody = {
                CARDNBR: this.cardInfo_3004.CARDNBR, // 卡号
                INQOPT: '2',//查询类型，1-按信用卡号，2-按证件号码
                PINFLAG: '0',//查询类型，1-按信用卡号，2-按ETC卡号
                CUSTID: this.customerInfo_3002.CUSTID,// 证件号码，
                KEYTYPE: this.customerInfo_3002.KEYTYPE,// 证件类型
                RTNIND: '',//翻页标志
                NAME: '',//
                TEL: '',
                MOBILE: '',

            };
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '3064';
            defaultParams.body.appBody = appBody;
            // 3070交易
            await this.$post.common.transPort(defaultParams).then((res) => {
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    if (result.sysHead.rspCd === '000000') {
                        if (result.body.appBody.dataList.length > 0) {
                            for (let i = 0; i < result.body.appBody.dataList.length; i++) {
                                this.conname = this.conname + '，' + result.body.appBody.dataList[i].NAME1.trim();
                            }
                            this.conname = this.conname.substring(1, this.conname.length)
                        }
                    }
                }
            });
        },

        //计算选核项答题数
        countanswer() {
            if (!this.ifaddcheck) {
                if (this.checkMustForm.ifhascard === '') {
                    this.$confirm('请选择是否可获得卡片信息！', '提示', {
                        customClass: 'warning', type: 'warning',
                        type: 'warning',
                        showClose: false
                    });
                    return;
                }

                this.countitems();

                //如果可获得卡号信息，选核项答题总数为5，即刻把所有选核项题目锁定不可选
                if (this.checkMustForm.ifhascard === '1') {
                    this.idnocheckflag = false;
                    this.expirecheckflag = false;
                    this.cardnocheckflag = false;
                    if (this.totanswercount >= 5) {
                        this.isShow = true;
                    } else {
                        this.isShow = false;
                    }
                } else if (this.checkMustForm.ifhascard === '0') { //如果不可获得卡片信息，选核项答题总数为7，即刻把所有选核项题目锁定不可选
                    this.idnocheckflag = false;
                    this.cardnocheckflag = true;
                    this.expirecheckflag = true;
                    if (this.totanswercount >= 7) {
                        this.isShow = true;
                    } else {
                        this.isShow = false;
                    }
                }
            } else {
                this.countitems();
                if (this.totanswercount >= 3) {
                    this.isShow = true;
                } else {
                    this.isShow = false;
                }
            }

        },
        countitems() {
            let answercnt = 0;//答题总数
            let errcount = 0;//错误题数
            let succount = 0;//正确题数

            if (this.checkUnmustForm.mbphonepass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.mbphonepass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.resvpass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.resvpass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.resv2pass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.resv2pass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.stmtaddrpass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.stmtaddrpass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.connamepass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.connamepass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.crdlimtpass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.crdlimtpass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.autopaypass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.autopaypass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.stmtaddtppass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.stmtaddtppass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.homephonepass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.homephonepass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.emailpass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.emailpass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.stmtdaypass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.stmtdaypass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.comaddrpass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.comaddrpass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.homeaddrpass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.homeaddrpass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.comnamepass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.comnamepass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.comphonepass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.comphonepass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.cnamepass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.cnamepass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            if (this.checkUnmustForm.cpurpass === '1') {
                answercnt = answercnt + 1;
                succount = succount + 1;
            } else if (this.checkUnmustForm.cpurpass === '0') {
                answercnt = answercnt + 1;
                errcount = errcount + 1;
            }
            console.log("选核项答题数：" + answercnt + ",正确题数：" + succount + "，错误题数：" + errcount);
            this.totanswercount = answercnt;
            this.succanswercount = succount;
            this.erranswercount = errcount;
        },

        // 点击提交
        handlePass() {
            if (!this.ifaddcheck) {
                if (this.checkMustForm.ifhascard === '') {
                    this.$confirm('请选择是否可获得卡片信息！', '提示', {
                        customClass: 'warning', type: 'warning',
                        type: 'warning'
                    });
                    return;
                }
                if (this.checkMustForm.ifhascard === '1') {
                    //判断必核项是否答题完毕
                    if (this.checkMustForm.idnopass === '' || this.checkMustForm.expirepass === '' || this.checkMustForm.cardnopass === '') {
                        this.$confirm('必核项尚未完成核实！', '提示', {
                            customClass: 'warning', type: 'warning',
                            type: 'warning'
                        });
                        return;
                    }
                    //判断选核项是否答题完毕，如果答题完成，判断是否通过身份验证
                    if (this.totanswercount < 5) {
                        this.$confirm('选核项尚未完成核实！', '提示', {
                            customClass: 'warning', type: 'warning',
                            type: 'warning'
                        });
                        return;
                    }
                    //判断是否通过验证，可获得卡片信息，必核项全对，选核项错误不超过1，通过，否则不通过
                    if (this.checkMustForm.idnopass === '0' || this.checkMustForm.expirepass === '0' || this.checkMustForm.cardnopass === '0' || this.erranswercount > 1) {
                        this.passFlag = false;
                    } else {
                        this.passFlag = true;
                    }
                } else if (this.checkMustForm.ifhascard === '0') {
                    //判断必核项是否答题完毕
                    if (this.checkMustForm.idnopass === '') {
                        this.$confirm('必核项尚未完成核实！', '提示', {
                            customClass: 'warning', type: 'warning',
                            type: 'warning'
                        });
                        return;
                    }
                    //判断选核项是否答题完毕，如果答题完成，判断是否通过身份验证
                    if (this.totanswercount < 7) {
                        this.$confirm('选核项尚未完成核实！', '提示', {
                            customClass: 'warning', type: 'warning',
                            type: 'warning'
                        });
                        return;
                    }
                    //判断是否通过验证，不可活动卡片信息，证件号码对，选核项错误不超过一个，通过，否则不通过
                    if (this.checkMustForm.idnopass === '0' || this.erranswercount > 1) {
                        this.passFlag = false;
                    } else {
                        this.passFlag = true;
                    }
                }
                //保存身份验证答题信息
                this.$store.commit('common/SAVE_CHECK_MUST_FORM', this.checkMustForm);
                this.$store.commit('common/SAVE_CHECK_UNMUST_FORM', this.checkUnmustForm);

                //判断是否通过验证
                if (!this.passFlag) {
                    this.$confirm('高风险身份验证不通过！', '提示', {
                        customClass: 'error', type: 'error',
                        type: 'error',
                    });
                    return;
                } else {
                    //如果当前身份验证级别小于3,更新身份验证级别
                    if (this.currentRiskLevel < 3) {
                        this.$store.commit('common/UPDATE_RISKLEVEL', 3);
                    }
                    this.$confirm('高风险身份验证通过', '提示', {
                        customClass: 'success', type: 'success',
                        type: 'success',
                    }).then(() => {
                        this.handleClose();
                    });
                }
            } else {
                //判断加核项是否答题完毕，如果答题完成，判断是否通过身份验证
                if (this.totanswercount < 3) {
                    this.$confirm('加核项尚未完成核实！', '提示', {
                        customClass: 'warning', type: 'warning',
                        type: 'warning',
                    });
                    return;
                }
                //判断是否通过验证，加核项全对，通过，否则不通过
                if (this.erranswercount > 1) {
                    this.passFlag = false;
                } else {
                    this.passFlag = true;
                }
                //保存身份验证答题信息

                this.$store.commit('common/SAVE_CHECK_UNMUST_FORM', this.checkUnmustForm);

                //判断是否通过验证
                if (!this.passFlag) {
                    this.$confirm('附加身份验证不通过！', '提示', {
                        customClass: 'error', type: 'error',
                        type: 'error',
                    });
                    return;
                } else {

                    this.$store.commit('common/UPDATE_RISKLEVEL', 4);
                    this.$confirm('附加身份验证通过', '提示', {
                        customClass: 'success', type: 'success',
                        type: 'success',
                    }).then(() => {
                        this.handleClose();
                    });
                }
            }
        },

        //清空业务风险验证内容
        resetRiskCheck() {
            this.isShow = false;
            this.$store.commit('common/RESET_CHECK_MUST_FORM');
            this.$store.commit('common/RESET_CHECK_UNMUST_FORM');
        },

        // 关闭页面
        handleClose() {
            closePage(this.$route, this, 1);
        },
    },
};
</script>

<style lang="scss">
.highriskvalidate {
    margin: 20px 16px 30px;

    .el-table {
        position: relative;
        overflow: hidden;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        -webkit-box-flex: 1;
        -ms-flex: 1;
        flex: 1;
        width: 100%;
        max-width: 100%;
        font-size: 12px;
        color: #606266;
    }

    .pageTips {
        padding-bottom: 20px;
        padding-top: 10px;
        color: red;
        overflow: hidden;

        .leftBox {
            float: left;
            max-width: 85%;
            p {
                height: 20px;
                line-height: 20px;
                margin-bottom: 10px;
            }
        }
        .rightBox {
            float: right;
            width: 260px;
            text-align: center;
            margin-right: 50px;
        }
    }
    .box-card {
        margin-bottom: 20px;
        background-color: #f2f6fb;

        .clearfix {
            text-align: center;
        }

        .container {
            .questionItem {
                margin-bottom: 20px;
                .title {
                    padding-right: 10px;
                    display: inline-block;
                    text-align: right;
                    width: 130px;
                }
            }
            .footer {
                margin-top: 20px;
                text-align: right;
            }
        }
    }
    .box-group .content p,
    .box-group .content .pStyle {
        color: #000;
        font-size: 14px;
        text-align: left;

        line-height: 36px;
        span.title {
            width: 128px;
            display: inline-block;
            text-align: right;
        }
        .cell {
            min-width: 246px;
            display: inline-block;
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
            vertical-align: middle;
        }
        span.el-radio__input {
            text-align: right;
            display: inline-block;
            margin-right: 4px;
        }
        span.el-radio__label {
            margin-right: 5px;
            font-size: 12px;
            padding-left: 0px;
        }
        .el-radio-group {
            float: right;
            width: 18%;
            min-width: 100px;
        }
    }

    .box-group .el-radio-group {
        display: inline-block;
        line-height: 1;
        vertical-align: text-bottom;
        width: 110px;
        margin-left: 5px;
        .el-radio {
            margin-top: 10px;
            margin-right: 10px;
        }
    }
}
</style>
